function submitform() {
    var title=$('the_title').innerHTML.substring(6*3, $('the_title').innerHTML.length);
      var pseudo;var email;var mdp;var mdp2;

    switch(title) {
        case 'Inscription':

            pseudo=document.getElementById("pseudo").value;
            email=document.getElementById("email").value;
            mdp=document.getElementById("password").value;
            mdp2=document.getElementById("password2").value;
            //alert("pseudo "+pseudo+" -- "+mdp+" -- mdp2 :"+mdp2);

            if ((pseudo!="") && (mdp!="") && (mdp2!="") && (mdp2==mdp)){
                var data="fonction=1&pseudo="+escape(pseudo)+"&password="+escape(mdp)+"&mail="+escape(email);
                
                var rep=file_aj("FonctionServlet1",data);
                $("repAjax").innerHTML=rep;
                //alert("inscription ok");

            }

            //alert('Inscription');
        break;
        case 'Connexion':
            pseudo=document.getElementById("pseudo").value;
            mdp=document.getElementById("password").value;
           //  alert("pseudo : "+pseudo+" mdp : "+mdp);
            if ((pseudo!="") && (mdp!="")){
               data="fonction=2&pseudo="+escape(pseudo)+"&password="+escape(mdp);
              // alert(data);
               rep=file_aj("FonctionServlet1",data);
              
                $("repAjax").innerHTML=rep;
                closebox('Inscription', 1);
                 document.location.reload();


            }
          //  alert('Connexion');
        break;
    }
}




function file_aj(fichier,data){
	
	if(window.XMLHttpRequest){ // FIREFOX
	
	//	alert ("creation de l'objet ActiveXobjectt"+objactiv);
	xhr_object = new XMLHttpRequest();

	}
	else if(window.ActiveXObject) // IE
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else
		return(false);

	xhr_object.open("POST", fichier, false);
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	//alert( "envoi de la requetes ");

	xhr_object.send(data);

	if(xhr_object.readyState == 4) {var tr=xhr_object.responseText;xhr_object.cancel; return (tr);}
	else return(false);
}

function deconnection(cas){

               var data="fonction=3";
               var rep=file_aj("FonctionServlet1",data);
            
    if (rep=="deconnection"){
        $('login_connexion2').setStyle({'display':'none'});
           //alert("rechargement");
            document.location.reload();
    }else{
          document.location.reload()
        //  $('login_connexion1').setStyle({'display':'block'});
        //  $('login_inscription').setStyle({'display':'block'});
    }

}
